<?php
/**
 * Created by PhpStorm.
 * User: kcj
 * Date: 2017/5/23
 * Time: 17:04
 */
date_default_timezone_set('Asia/Shanghai');
define('APP_PATH', __DIR__ );
require_once "common/RedisDB.php";
use app\common\RedisDB;

$redis = RedisDB::factory("wtimer");
$timeout = 5;


while (true)
{
    $curl = curl_init();
    $url = "http://120.77.89.251/api.php/index/index/posttest";// . $content;

    //设置抓取的url
    curl_setopt($curl, CURLOPT_URL, $url);
    //设置头文件的信息作为数据流输出
    curl_setopt($curl, CURLOPT_HEADER, 1);
    //设置获取的信息以文件流的形式返回，而不是直接输出。
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 0);
    //设置post方式提交
    //curl_setopt($curl, CURLOPT_POST, 1);
    echo "\n\t";
    print_r(date("Y-m-d H:i:s",time()).'add:' . $url);
    echo "\n\t";
    //执行命令
    $data = curl_exec($curl);
    //关闭URL请求
    //显示获得的数据
    print_r($data);
    curl_close($curl);
    sleep(1);
}

